<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>后台管理</title>
{{include file="layouts/_head"}}
<style type="text/css">
.set_menu a {
    font-weight: 600;
}
.set_menu a:hover {
    color: #777 !important;
}
.set_menu a:visited {
    color: #777 !important;
}
.set_menu li.active a {
    color: #333 !important;
}	
.pc_image {
	width: 120px;
	height: 40px; 
	border: 1px solid #eee; 
	padding: 5px;
}
.mobile_image {
	width: 40px;
	height: 40px; 
	border: 1px solid #eee; 
	padding: 5px;
}
</style>
</head>
<body>
<div class="main">
	<ol class="breadcrumb">
	 	<li><i class="icon_home iconfont"></i>首页</li>   
	  	<li>设置中心</li>
	  	<li class="active">系统设置</li>
	</ol>
	<div class="bg-danger clearfix main-head-info error-info"></div>
	<nav class="navbar navbar-default set_menu">
        <ul class="nav navbar-nav">
            <li><a href="{{:url('/admin/set/system')}}">基础配置</a></li>
            <li class="active"><a href="{{:url('/admin/set/payment')}}?id=1">支付方式</a></li>
            <li><a href="{{:url('/admin/set/oauth')}}?id=qq">互联登录</a></li>
            <li><a href="{{:url('/admin/set/sms')}}">短信设置</a></li>
            <li><a href="{{:url('/admin/set/mail')}}">邮件设置</a></li>
            <li><a href="{{:url('/admin/set/client')}}?id=wx_app">应用配置</a></li>
        </ul>
    </nav>
	<div class="main-con">
		<ul class="nav nav-tabs" >
            <li {{if Request()->id == '1'}}class="active"{{/if}}><a href="{{:url('/admin/set/payment')}}?id=1">支付宝支付</a></li>
            <li {{if Request()->id == '2'}}class="active"{{/if}}><a href="{{:url('/admin/set/payment')}}?id=2">公众号支付</a></li>
            <li {{if Request()->id == '3'}}class="active"{{/if}}><a href="{{:url('/admin/set/payment')}}?id=3">小程序支付</a></li>
            <li {{if Request()->id == '4'}}class="active"{{/if}}><a href="{{:url('/admin/set/payment')}}?id=4">余额支付</a></li>
        </ul>
		<form class="form-horizontal margin-t-30" id="form" method="post" action="{{:url('/admin/set/payment')}}">
			<input type="hidden" name="id" value="{{$payment.id}}">
		  	<div class="tab-box">
			  	<div class="form-group">
			    	<span class="col-sm-2 control-label">名字：</span>
			    	<div class="col-sm-8 input-group">
			    		<p class="form-control-static">{{$payment.name}} </p>
			    	</div>
			  	</div>
			  	<div class="form-group">
                    <span class="col-sm-2 control-label">电脑端图标：</span>
                    <div class="col-sm-4 input-group">
                    	<img class="pc_image" src="{{$payment.pc_image}}">
                    </div>
                </div>
                <div class="form-group">
                    <span class="col-sm-2 control-label">移动端图标：</span>
                    <div class="col-sm-4 input-group">
                    	<img class="mobile_image" src="{{$payment.mobile_image}}">
                    </div>
                </div>
                {{if $payment.id == 1}}
                <div class="form-group">
			    	<span class="col-sm-2 control-label">AppID：</span>
				    <div class="col-sm-8 input-group">
				      <input class="form-control" name="appid" value="{{$payment.config.appid}}">
				    </div>
			  	</div>
                <div class="form-group">
				    <span class="col-sm-2 control-label">商户私钥：</span>
				    <div class="col-sm-8 input-group">
				      <textarea class="form-control" rows="3" name="rsaPrivateKey">{{$payment.config.rsaPrivateKey}}</textarea>
				    </div>
				</div>
				<div class="form-group">
				    <span class="col-sm-2 control-label">支付宝公钥：</span>
				    <div class="col-sm-8 input-group">
				      <textarea class="form-control" rows="3" name="alipayPublicKey">{{$payment.config.alipayPublicKey}}</textarea>
				    </div>
				</div>
                {{/if}}
                {{if $payment.id == 2}}
			  	<div class="form-group">
			    	<span class="col-sm-2 control-label"><i class="iconfont iconfont-question" data-toggle="tooltip" data-placement="top" data-original-title="公众号开发者ID"></i> AppID：</span>
				    <div class="col-sm-8 input-group">
				      <input class="form-control" name="appid" value="{{$payment.config.appid}}">
				    </div>
			  	</div>
			  	<div class="form-group">
			    	<span class="col-sm-2 control-label"><i class="iconfont iconfont-question" data-toggle="tooltip" data-placement="top" data-original-title="商户号ID"></i> Mchid：</span>
				    <div class="col-sm-8 input-group">
				      <input class="form-control" name="mchid" value="{{$payment.config.mchid}}">
				    </div>
			  	</div>
			  	<div class="form-group">
			    	<span class="col-sm-2 control-label"><i class="iconfont iconfont-question" data-toggle="tooltip" data-placement="top" data-original-title="商户号API密钥"></i> ApiKey：</span>
				    <div class="col-sm-8 input-group">
				      <input class="form-control" name="apikey" value="{{$payment.config.apikey}}">
				    </div>
			  	</div>
				{{/if}}
				{{if $payment.id == 3}}
			  	<div class="form-group">
			    	<span class="col-sm-2 control-label"><i class="iconfont iconfont-question" data-toggle="tooltip" data-placement="top" data-original-title="小程序开发者ID"></i> AppID：</span>
				    <div class="col-sm-8 input-group">
				      <input class="form-control" name="appid" value="{{$payment.config.appid}}">
				    </div>
			  	</div>
			  	<div class="form-group">
			    	<span class="col-sm-2 control-label"><i class="iconfont iconfont-question" data-toggle="tooltip" data-placement="top" data-original-title="小程序开发者密码"></i> AppSecret：</span>
				    <div class="col-sm-8 input-group">
				      <input class="form-control" name="appsecret" value="{{$payment.config.appsecret}}">
				    </div>
			  	</div>
			  	<div class="form-group">
			    	<span class="col-sm-2 control-label"><i class="iconfont iconfont-question" data-toggle="tooltip" data-placement="top" data-original-title="商户号ID"></i> Mchid：</span>
				    <div class="col-sm-8 input-group">
				      <input class="form-control" name="mchid" value="{{$payment.config.mchid}}">
				    </div>
			  	</div>
			  	<div class="form-group">
			    	<span class="col-sm-2 control-label"><i class="iconfont iconfont-question" data-toggle="tooltip" data-placement="top" data-original-title="商户号API密钥"></i> ApiKey：</span>
				    <div class="col-sm-8 input-group">
				      <input class="form-control" name="apikey" value="{{$payment.config.apikey}}">
				    </div>
			  	</div>
				{{/if}}
				<div class="form-group">
				    <span class="col-sm-2 control-label">状态：</span>
				    <div class="col-sm-2 input-group">
					<select class="form-control" name="status">
						<option value="1" {{if $payment.status == 1}}selected="true"{{/if}}>开启</option>
                        <option value="0" {{if $payment.status == '0'}}selected="true"{{/if}}>关闭</option>
					</select>
				    </div>
				</div>
			</div>
			<div class="foot_btn_blank"></div>
            <div class="foot_btn">
                <div class="box">
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
            </div>
		</form>
	</div>
</div>
{{include file="layouts/_foot"}}
{{include file="shared/_jquery_validation"}}
<script type="text/javascript">
$("#form").validate({
	submitHandler:function(){
		layer.confirm('确认提交？', function() {
			layer.closeAll(); var load = layer.load();
			$("#form").ajaxSubmit(function(res) {
				layer.close(load);
                if (res.code == 401) {
                    goLogin(); return false;
                }
                if (res.code == 200) {
                    layer.msg('提交成功', { time: 1500 }, function () { window.location.reload(); });
                } else if (res.code == 400) {
                    layer.msg(res.message); return false;
                } else {
                    layer.msg('操作失败'); return false;
                }
			});
		});	
	}
});
</script>
</body>
</html>